gicv3: Fix support for systems without secure interrupts
authorAndre Przywara <[email protected]>
Thu, 9 Nov 2017 18:08:00 +0000 (12:08 -0600)
committerAndre Przywara <[email protected]>
Tue, 3 Apr 2018 15:45:10 +0000 (16:45 +0100)
Accessing the interrupt_props array only happens inside a loop over
interrupt_props_num, so the GICv3 driver can cope with no secure
interrupts. This allows us to relax the asserts that insists on
a non-NULL interrupt_props pointer and at least one secure interrupt.
This enables GICv3 platforms which have no need for a secure interrupt.

This only covers the non-deprecated code paths.

Change-Id: I49db291906512f56af065772f69acb281dfbdcfb
Signed-off-by: Andre Przywara <[email protected]>
drivers/arm/gic/v3/gicv3_helpers.c
drivers/arm/gic/v3/gicv3_main.c

index 69c6951281d3eb46ee6deecdf62f523fc84fb624..020ec1b635f90d085eb0c8c3f4b822196fcda23a 100644 (file)
@@ -433,8 +433,7 @@ unsigned int gicv3_secure_spis_configure_props(uintptr_t gicd_base,
        unsigned int ctlr_enable = 0;
 
        /* Make sure there's a valid property array */
-       assert(interrupt_props != NULL);
-       assert(interrupt_props_num > 0);
+       assert(interrupt_props_num > 0 ? interrupt_props != NULL : 1);
 
        for (i = 0; i < interrupt_props_num; i++) {
                current_prop = &interrupt_props[i];
@@ -556,8 +555,7 @@ unsigned int gicv3_secure_ppi_sgi_configure_props(uintptr_t gicr_base,
        unsigned int ctlr_enable = 0;
 
        /* Make sure there's a valid property array */
-       assert(interrupt_props != NULL);
-       assert(interrupt_props_num > 0);
+       assert(interrupt_props_num > 0 ? interrupt_props != NULL : 1);
 
        for (i = 0; i < interrupt_props_num; i++) {
                current_prop = &interrupt_props[i];
index d8fc7d683fc4929616f281a552a10d13c9c1aee5..82f43d0856e3cf7cce3c0e8067a3625709bcae24 100644 (file)
@@ -103,8 +103,8 @@ void gicv3_driver_init(const gicv3_driver_data_t *plat_driver_data)
                WARN("Please migrate to using interrupt_prop_t arrays\n");
        }
 #else
-       assert(plat_driver_data->interrupt_props != NULL);
-       assert(plat_driver_data->interrupt_props_num > 0);
+       assert(plat_driver_data->interrupt_props_num > 0 ?
+              plat_driver_data->interrupt_props != NULL : 1);
 #endif
 
        /* Check for system register support */